import body1 from './body-1.png'
import body2 from './body-2.png'
import body3 from './body-3.png'
import body4 from './body-4.png'
import body5 from './body-5.png'
import head from './snake-head.png'
const bodyList = [
  body1, body2, body3, body4,body5
]
export const getSnakeBodyImg = () => {
  const snakeBody = new Image()
  const index = Math.floor(Math.random() * bodyList.length);
  snakeBody.src = bodyList[index]
  return snakeBody
}

export const getSnakeHeadImg = () => {
  return new Promise((resolve, reject) => {
    const snakeBody = new Image()
    snakeBody.src = head
    snakeBody.onload = () => {
      resolve(snakeBody)
    }
  })
}